<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="UTF-8" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title>Document</title>
  </head>
  <body>
    <script>
      var a = 100
      var b = 200
      function add(c, d, e) {
        return this.a + this.b + c + d + e
      }
      console.log(add(1, 2, 3))

      let o = { a: 10, b: 20 }

      console.log('call:', add.call(o, 1, 2, 3))
      console.log('apply:', add.apply(o, [1, 2, 3]))

      //数组型对象就是有2个典型特征
      // 1. 有length属性，2 有0,1这样的数字型的属性
      let arrLikeObj = { length: 3, 0: 'a', 1: 'b', 2: 'c' }
      console.log(arrLikeObj[0], arrLikeObj[1], arrLikeObj[2])

      let newArr = Array.prototype.slice.call(arrLikeObj)
      console.log('typeof newArr: ', typeof newArr)
      console.log(newArr[0], newArr[1])
    </script>
  </body>
</html>
